package com.samoiloff.ui.scroll.simple {
	import com.samoiloff.framework.model.BaseModel;

	import flash.display.MovieClip;
	import flash.events.Event;

	/**
	 * @author Samoiloff
	 */
	public class SimpleScrollModel extends BaseModel {
		
		public static const PROGRESS_CHANGED:String = "progressChanged";
		
		private var _progress: Number;
		
		public function SimpleScrollModel(component:SimpleScroll) {
			super(component);
		}
		
		public function init(mainMc:MovieClip):void {
			setMainMc(mainMc);
			_progress = 0;
			complete();
		}
		
		public function get progress(): Number {
			return _progress;
		}
		
		public function set progress(progress: Number): void {
			if (progress < 0) progress = 0;
			if (progress > 1) progress = 1;
			
			if (progress != _progress) {
				_progress = progress;
				dispatchEvent(new Event(PROGRESS_CHANGED));
			}
		}
	}
}
